#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/11/14 17:36
# @Author  : 作者名
# @Site    :
from tornado import web
from typing import Any, Optional, Awaitable


class BaseHandler(web.RequestHandler):

    @property
    def db(self):
        return self.application.db   #  使用方法 self.db

    @property
    def redis(self):
        return self.application.redis

    def prepare(self) -> Optional[Awaitable[None]]:
        pass

    def write_error(self, status_code: int, **kwargs: Any) -> None:
        pass

    def set_default_headers(self) -> None:
        pass

    def intialize(self):
        pass

    def on_finish(self) -> None:
        pass
